package com.start.workflow.vo;

import io.swagger.v3.oas.annotations.media.Schema;

import lombok.Data;
import org.activiti.engine.runtime.ProcessInstance;

import java.util.Date;

@Data
 @Schema(name="ProcessInstanceInfo", description = "流程实例信息")
public class ProcessInstanceInfo extends BaseProcessInfo<ProcessInstance, ProcessInstanceInfo> {
     @Schema(name="流程实例主键")
    private String id;
     @Schema(name="开始用户")
    private String startUserId;
     @Schema(name="开始时间")
    private Date startTime;
     @Schema(name="流程名称")
    private String name;
     @Schema(name="部署id")
    private String deploymentId;
     @Schema(name="流程定义名称")
    private String processDefinitionName;
     @Schema(name="流程定义key")
    private String processDefinitionKey;
     @Schema(name="流程定义id")
    private String processDefinitionId;
     @Schema(name="业务key")
    private String businessKey;
     @Schema(name="应用版本")
    private Integer appVersion;

    @Override
    public ProcessInstanceInfo transform(ProcessInstance processInstance) {
        this.setId(processInstance.getId());
        this.setName(processInstance.getName());
        this.setBusinessKey(processInstance.getBusinessKey());
        this.setDeploymentId(processInstance.getDeploymentId());
        this.setStartTime(processInstance.getStartTime());
        this.setStartUserId(processInstance.getStartUserId());
        this.setProcessDefinitionKey(processInstance.getProcessDefinitionKey());
        this.setProcessDefinitionName(processInstance.getProcessDefinitionName());
        this.setProcessDefinitionId(processInstance.getProcessDefinitionId());
        this.setAppVersion(processInstance.getAppVersion());
        return this;
    }

}
